<!DOCTYPE HTML>  
<html>  
<head>  
    <meta http-equiv="content-type" content="text/html" />  
    <meta name="author" content="https://github.com/jice1001" />  
    <title>websocket test</title>  
    <script>
		var socket;  
		function Connect(){
			if ("WebSocket" in window)
			{
				try{  
					socket=new WebSocket('ws://192.168.5.133:9000');  
				}catch(e){  
					alert('error');  
					return;  
				}  
				socket.onopen = sOpen;  
				socket.onerror = sError;
				socket.onmessage= sMessage;
				socket.onclose= sClose;
			} else {
			alert("您的浏览器不支持WebScoket");
			}
		}  
		
		function sOpen(){
			alert('connect success!');
		}
		function sError(e){
			alert("error " + e);
		}
		function sMessage(msg){  
			alert('server says:' + msg);  
		}
		function sClose(e){
			alert("connect closed:" + e.code);
		}  
		function Send(){
			socket.send(document.getElementById("msg").value);
		} 
		function Close(){
			socket.close();
		} 
		function pullopen_1(){
			var pullurl  = "http://xxxxxxxxxxxxxxxxx";
			var startcmd='{"jsonrpc": "2.0", "method": "DoPullStreamwork", "params":"'+pullurl +'", "id": 2}';
			if (socket != null) {
				socket.send( startcmd );
			}   
		} 
		function pullclose_1(){
			
		} 
		function push1open(){
			
		} 
		function push1close(){
			
		} 
		function push2open(){
			
		} 
		function push2close(){
			
		} 
		function push3open(){
			
		} 
		function push3close(){
			
		} 
		
		
	</script>
</head>  
   
<body>  
<textarea id="msg"></textarea>  
<button id="connect" onClick="Connect();">Connect</button>  
<button id="send" onClick="Send();">Send</button>  
<button id="close" onClick="Close();">Close</button>

<p>&nbsp;</p>
<p>----------------------------------pull stream----------------------</p>
<p><em>
  <button id="pullopen_1" onClick="pullopen_1();">pull1_open</button>
  <button id="pullclose_1" onClick="pullclose_1();">pull1_close</button>
 </em></p>
<p>&nbsp;</p>
 <p>
 <p>--------------------------------- push stream--------------</p>
 <p><button id="push1open" onClick="push1open();">push1_open</button>
  <button id="push1close" onClick="push1close();">push1_close</button>&nbsp;</p>
  
 <p>
   <button id="push2open" onClick="push2open();">push2_open</button>
 <button id="push2close" onClick="push2close();">push2_close</button>&nbsp;</p>
  
 <p><button id="push3open" onClick="push3open();">push3_open</button>
  <button id="push3close" onClick="push3close();">push3_close</button>&nbsp;</p>&nbsp;</p>
 <p>&nbsp;</p>
</body>  
   
</html>  